package com.imti.controller;

import com.imti.model.ExmVo;
import com.imti.service.ExamService;
import com.imti.service.PaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/exam")
public class ExamController {

    @Autowired
    PaperService paperService;

    @Autowired
    ExamService examService;

    @RequestMapping("/start/{id}")//试卷id
    public String startExam(@PathVariable("id") Integer id, HttpServletRequest request){
        request.setAttribute("pid",id);
        paperService.showPaper(id,request);
        return "paper/exam-paper";
    }
    @RequestMapping("/end")
    public String startExam(ExmVo exmVo, HttpServletRequest req){
        examService.subPap(exmVo);
        return "paper/exam-paper";
    }
}
